<template>
  <div class="page-container index-body">
    <header class="header">
      <a href="#" class="logo">
        <svg-icon class="svg-logo" icon="icon-logo" />
        <span class="name">Visualio.</span>
      </a>
      <nav class="navbar">
        <a href="#" class="active item" style="--i: 1">主页</a>
        <a href="#" class="item" style="--i: 2">关于我们</a>
        <a
          href="https://gitee.com/xhzq_zhangmeng/vue-editable-2.x.git"
          class="item"
          style="--i: 4"
          >产品</a
        >
        <a href="#" class="item" style="--i: 5">联系</a>
      </nav>
    </header>

    <section class="home">
      <div class="home-content">
        <span class="inline-block">数字大屏设计</span>
        <h1>Call Me Visualio.</h1>
        <h3>
          <span class="multiple-text">
            <h3>And I'm a</h3>
            <vue-typed-js
              :strings="str"
              :loop="true"
              :startDelay="300"
              :typeSpeed="100"
              :backSpeed="50"
            >
              <span class="typing"></span>
            </vue-typed-js>
          </span>
        </h3>
        <p>拖拽式组件、可配置样式、组件交互、多种数据加载方式。</p>
        <p>让产品维护更简单。</p>
        <div class="btn" @click="handleGo('/Login')">立即使用</div>
      </div>
      <div class="home-img">
        <svg-icon class="logo" icon="icon-logo" />
      </div>
    </section>
  </div>
</template>

<script>
export default {
  data() {
    return {
      str: ["Visual Editor", "Low code management platform."],
    };
  },
  methods: {
    handleGo(path) {
      this.$router.push({ path });
    },
  },
};
</script>

<style lang="scss" scoped>
.index-body {
  width: 100%;
  height: 100%;
  background: #1f242d;
  color: #fff;
  overflow: hidden;
}

.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 20px 10%;
  box-sizing: border-box;
  background: transparent;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
}

.logo {
  font-size: 25px;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  opacity: 0;
  animation: slideRight 1s ease forwards;
  display: flex;
  align-items: center;

  .name {
    margin: 0 6px;
  }

  .svg-logo {
    width: 32px;
    height: 32px;
  }
}

.navbar a {
  display: inline-block;
  font-size: 18px;
  color: #fff;
  text-decoration: none;
  font-weight: 500;
  margin-left: 35px;
  opacity: 0;
  transition: 0.3s;
  animation: slideTop 1s ease forwards;
  animation-delay: calc(0.2s * var(--i));
}

.navbar a:hover,
.navbar a.active {
  color: #b7b2a9;
}

.home {
  position: relative;
  width: 80%;
  height: 100vh;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-sizing: border-box;
}

.multiple-text {
  width: 100%;
  display: flex;

  & h3 {
    color: #b7b2a9;
    margin-right: 16px;
    opacity: 0;
    animation: slideTop 1s ease forwards;
    animation-delay: calc(0.4s * var(--i));
  }
}

.home-content {
  max-width: 800px;
}

.home-content .inline-block {
  font-size: 46px;
  font-weight: 700;
  opacity: 0;
  animation: slideBottom 1s ease forwards;
  animation-delay: 0.7s;
  color: transparent !important;
  background-clip: text !important;
  background-image: linear-gradient(to right, #409eff 5%, #fff 95%) !important;
}

.home-content h3:nth-of-type(2) {
  margin-bottom: 30px;
  opacity: 0;
  animation: slideTop 1s ease forwards;
  animation-delay: 0.7s;
}

.home-content h3 span {
  color: #b7b2a9;
}

.home-content h1 {
  font-size: 56px;
  font-weight: 700;
  margin: -3px 0;
  opacity: 0;
  animation: slideRight 1s ease forwards;
  animation-delay: 1s;
}

.home-content p {
  font-size: 20px;
  opacity: 0;
  animation: slideLeft 1s ease forwards;
  animation-delay: 0.7s;
}

.home-img {
  max-width: 450px;
  border-radius: 50%;
  margin-right: -20px;
  opacity: 0;
  animation: zoomIn 1s ease forwards, floatImage 4s ease-in-out infinite;
  animation-delay: 2s, 3s;

  .logo {
    width: 200px;
    height: 200px;
  }
}

.btn {
  margin-top: 24px;
  display: inline-block;
  padding: 12px 28px;
  box-sizing: border-box;
  background: #b7b2a9;
  text-decoration: none;
  border-radius: 40px;
  box-shadow: 0 0 10px #b7b2a9;
  cursor: pointer;
  font-size: 18px;
  color: #fff;
  letter-spacing: 1px;
  font-weight: 600;
  transition: 0.5s ease;
  opacity: 0;
  animation: slideTop 1s ease forwards;
  animation-delay: 1s;
}

.btn:hover {
  box-shadow: 0 0 20px #b7b2a9;
}

.btn:active {
  background: none;
  color: #b7b2a9;
  border: 2px solid #b7b2a9;
}

/* 动画 */

@keyframes slideRight {
  0% {
    transform: translateX(-100px);
  }

  100% {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideLeft {
  0% {
    transform: translateX(100px);
  }

  100% {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideTop {
  0% {
    transform: translateY(100px);
  }

  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slideBottom {
  0% {
    transform: translateY(-100px);
  }

  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes zoomIn {
  0% {
    transform: scale(0);
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes floatImage {
  0% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-24px);
  }

  100% {
    transform: translateY(0);
  }
}
</style>